﻿using Hangfire;
using Microsoft.AspNetCore.Hosting;
using NP.BPMReportPlatform.RecurringJobs;
using System;
using Volo.Abp.DependencyInjection;

namespace NP.BPMReportPlatform.BackgroundJobs.Host
{
    /// <summary>
    /// 老BPM相关定时服务在此配置
    /// </summary>
    public class BpmPlatformJobCreator : ITransientDependency
    {
        public static void CreateJobs(IWebHostEnvironment env)
        {
            // 每天早上5点，老BPM人员同步程序
            RecurringJob.AddOrUpdate<IOldBPMSyncUserJob>("老BPM人员同步程序", c => c.SyncUser(), "0 5 * * *", TimeZoneInfo.Local);

            // 每天早上3、12点清理已审批的待办
            RecurringJob.AddOrUpdate<INIP_WechatRecurringJob>("老BPM清理已审批的待办", c => c.ClearApprovedToDoList(), "0 3,12 * * *", TimeZoneInfo.Local);

            //每天凌晨4点同步3个月前的已办数据到历史库
            RecurringJob.AddOrUpdate<IToDoAppServiceJob>("定时同步3个月前的已办数据到历史库", c => c.SyncWechatToWechatHistory(), "0 4 * * *", TimeZoneInfo.Local);

            //老BPM每分钟推送一次微信
            RecurringJob.AddOrUpdate<INIP_WechatRecurringJob>("老BPM每分钟推送一次微信", c => c.PushWechat(), "0 0/1 * * * ?", TimeZoneInfo.Local);
        }
    }

}
